package p270jp.pxv.android.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.databinding.DataBindingUtil;
import p014ae.AbstractActivityC0092i0;
import p014ae.View$OnClickListenerC0046a;
import p018ai.PixivSettings;
import p047bg.C1124a;
import p090d0.C2518n;
import p134ei.AnalyticsScreenName;
import p165fo.Subscribe;
import p210hh.PixivAccountManager;
import p270jp.pxv.android.R;
import p270jp.pxv.android.commonObjects.model.WorkType;
import p270jp.pxv.android.event.SelectFilterTagEvent;
import p270jp.pxv.android.model.CollectionTag;
import p307l9.EdgeTreatment;
import p314lg.ActivityMyCollectionBinding;
import p370ni.Restrict;
import p436q6.C5768b;
import p547uh.CollectionFilterDialogFragment;

/* renamed from: jp.pxv.android.activity.CollectionActivity */
/* loaded from: classes2.dex */
public class CollectionActivity extends AbstractActivityC0092i0 {

    /* renamed from: b0 */
    public long f18310b0;

    /* renamed from: c0 */
    public WorkType f18311c0;

    /* renamed from: d0 */
    public Restrict f18312d0 = Restrict.PUBLIC;

    /* renamed from: e0 */
    public CollectionTag f18313e0;

    /* renamed from: f0 */
    public boolean f18314f0;

    /* renamed from: g0 */
    public ActivityMyCollectionBinding f18315g0;

    /* renamed from: h0 */
    public PixivSettings f18316h0;

    /* renamed from: e1 */
    public static Intent m4834e1(Context context, long j, WorkType workType) {
        EdgeTreatment.m3909i(context);
        EdgeTreatment.m3910h(j > 0);
        EdgeTreatment.m3909i(workType);
        Intent intent = new Intent(context, CollectionActivity.class);
        intent.putExtra("USER_ID", j);
        intent.putExtra("WORK_TYPE", workType);
        return intent;
    }

    public void onClickFilterButton(View view) {
        long j = this.f18310b0;
        WorkType workType = this.f18311c0;
        Restrict dVar = this.f18312d0;
        CollectionTag collectionTag = this.f18313e0;
        int i = CollectionFilterDialogFragment.f27257p;
        Bundle bundle = new Bundle();
        bundle.putLong("USER_ID", j);
        bundle.putSerializable("WORK_TYPE", workType);
        bundle.putSerializable("RESTRICT", dVar);
        bundle.putParcelable("FILTER_TAG", collectionTag);
        CollectionFilterDialogFragment a0Var = new CollectionFilterDialogFragment();
        a0Var.setArguments(bundle);
        a0Var.show(m11131K0(), "collection filter");
    }

    @Override // p270jp.pxv.android.activity.AbstractActivityC4151b, p270jp.pxv.android.activity.BaseActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.f18315g0 = (ActivityMyCollectionBinding) DataBindingUtil.m11369d(this, R.layout.activity_my_collection);
        this.f18316h0 = (PixivSettings) C2518n.m7641d(PixivSettings.class);
        C1124a.m10197Q(this, this.f18315g0.f22474v, R.string.collection);
        this.f18310b0 = getIntent().getLongExtra("USER_ID", 0);
        if (bundle != null) {
            this.f18311c0 = (WorkType) bundle.getSerializable("WORK_TYPE");
            this.f18312d0 = (Restrict) bundle.getSerializable("RESTRICT");
            this.f18313e0 = (CollectionTag) bundle.getParcelable("FILTER_TAG");
        } else {
            this.f18311c0 = (WorkType) getIntent().getSerializableExtra("WORK_TYPE");
        }
        if (this.f18310b0 != PixivAccountManager.m5511e().f16499e) {
            this.f18757A.m6525e(AnalyticsScreenName.USER_COLLECTION);
        }
        this.f18315g0.f22473u.setOnSelectSegmentListener(new C5768b(this, 6));
        int i = this.f18311c0 == WorkType.ILLUST_MANGA ? 0 : 1;
        this.f18314f0 = true;
        this.f18315g0.f22473u.m4467a(getResources().getStringArray(R.array.illustmanga_novel), i);
        if (PixivAccountManager.m5511e().f16499e == this.f18310b0) {
            this.f18315g0.f22470r.setOnClickListener(new View$OnClickListenerC0046a(this, 1));
        } else {
            this.f18315g0.f22470r.setVisibility(8);
        }
    }

    @Subscribe
    public void onEvent(SelectFilterTagEvent selectFilterTagEvent) {
        this.f18312d0 = selectFilterTagEvent.getRestrict();
        this.f18313e0 = selectFilterTagEvent.getTag();
    }

    @Override // androidx.activity.ComponentActivity, p248j2.ActivityC3902g, android.app.Activity
    public void onSaveInstanceState(Bundle bundle) {
        bundle.putSerializable("WORK_TYPE", this.f18311c0);
        bundle.putSerializable("RESTRICT", this.f18312d0);
        bundle.putParcelable("FILTER_TAG", this.f18313e0);
        super.onSaveInstanceState(bundle);
    }
}
